using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMCuponRecibo
    {
        public BMCuponRecibo(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private CuponRecibo oCuponRecibo = new CuponRecibo();
        private DACuponRecibo daCuponRecibo = new DACuponRecibo();

        #region BMCuponReciboProximoId
        public CuponRecibo BMCuponReciboProximoId()
        {
            try
            {
                CuponRecibo cupon = new CuponRecibo();
                cupon = daCuponRecibo.DACuponReciboProximoId(connection);
                return cupon;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCuponReciboInsert
        public CuponRecibo BMCuponReciboInsert(CuponRecibo cupon)
        {
            try
            {
                cupon = daCuponRecibo.DACuponReciboInsert(connection, cupon);
                return cupon;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCuponReciboGetAllByIdCupon
        public List<CuponRecibo> BMCuponReciboGetAllByIdCupon(CuponRecibo cupon)
        {
            List<CuponRecibo> listaCupones = new List<CuponRecibo>();
            try
            {
                listaCupones = daCuponRecibo.DACuponRecibo_GetAllByIdCupon(connection, cupon);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaCupones;
        }
        #endregion

    }
}

